
import threading
import time

class timer:
	def __init__(self):
		self.callback = None
		self.argv = None
		self.flag = 0
		self.time = None

	def setCallBack(self, func, argv = None):
		self.callback = func
		self.argv = argv

	def startTimer(self, time, func = None, argv = None):
		self.setCallBack(func, argv)
		#self.time = threading.Timer(time, self.callback, self.argv)
		self.time = threading.Timer(time, self.callback)
		self.time.start()
		return 0

	def stopTimer(self):
		self.time.cancel()

